.class public Lcom/esfile/screen/recorder/media/glutils/d;
.super Ljava/lang/Object;
.source "OutputSurface.java"

# interfaces
.implements Landroid/graphics/SurfaceTexture$OnFrameAvailableListener;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/esfile/screen/recorder/media/glutils/d$a;
    }
.end annotation


# instance fields
.field private a:Ljavax/microedition/khronos/egl/EGL10;

.field private b:Ljavax/microedition/khronos/egl/EGLDisplay;

.field private c:Ljavax/microedition/khronos/egl/EGLContext;

.field private d:Ljavax/microedition/khronos/egl/EGLSurface;

.field private e:Landroid/graphics/SurfaceTexture;

.field private f:Landroid/view/Surface;

.field private g:Lcom/esfile/screen/recorder/media/glutils/e;

.field private h:Z

.field private final i:Ljava/lang/Object;

.field private j:I

.field private k:Lcom/esfile/screen/recorder/media/util/y;

.field private l:Landroid/os/HandlerThread;

.field private m:I

.field private n:Ljava/nio/ByteBuffer;

.field private o:Lcom/esfile/screen/recorder/media/glutils/d$a;


# direct methods
.method public constructor <init>()V
    .locals 1

    .line 9
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 10
    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->i:Ljava/lang/Object;

    const/4 v0, 0x0

    .line 11
    iput v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->j:I

    .line 12
    iput v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->m:I

    .line 13
    new-instance v0, Les/u8;

    invoke-direct {v0}, Les/u8;-><init>()V

    invoke-direct {p0, v0}, Lcom/esfile/screen/recorder/media/glutils/d;->a(Les/v8;)V

    return-void
.end method

.method public constructor <init>(II)V
    .locals 3

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 2
    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->i:Ljava/lang/Object;

    const/4 v0, 0x0

    .line 3
    iput v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->j:I

    .line 4
    iput v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->m:I

    if-lez p1, :cond_0

    if-lez p2, :cond_0

    .line 5
    invoke-direct {p0, p1, p2}, Lcom/esfile/screen/recorder/media/glutils/d;->c(II)V

    .line 6
    invoke-virtual {p0}, Lcom/esfile/screen/recorder/media/glutils/d;->e()V

    .line 7
    new-instance p1, Les/u8;

    invoke-direct {p1}, Les/u8;-><init>()V

    invoke-direct {p0, p1}, Lcom/esfile/screen/recorder/media/glutils/d;->a(Les/v8;)V

    return-void

    .line 8
    :cond_0
    new-instance v0, Ljava/lang/IllegalArgumentException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "width "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string p1, " <= 0 || height "

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string p1, " <= 0"

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-direct {v0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0
.end method

.method private a(Landroid/graphics/Rect;)V
    .locals 3

    if-eqz p1, :cond_0

    .line 15
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->k:Lcom/esfile/screen/recorder/media/util/y;

    if-eqz v0, :cond_0

    .line 16
    iget v1, p1, Landroid/graphics/Rect;->left:I

    .line 17
    invoke-virtual {v0}, Lcom/esfile/screen/recorder/media/util/y;->a()I

    move-result v0

    iget v2, p1, Landroid/graphics/Rect;->top:I

    sub-int/2addr v0, v2

    invoke-virtual {p1}, Landroid/graphics/Rect;->height()I

    move-result v2

    sub-int/2addr v0, v2

    .line 18
    invoke-virtual {p1}, Landroid/graphics/Rect;->width()I

    move-result v2

    .line 19
    invoke-virtual {p1}, Landroid/graphics/Rect;->height()I

    move-result p1

    .line 20
    invoke-static {v1, v0, v2, p1}, Landroid/opengl/GLES20;->glViewport(IIII)V

    :cond_0
    return-void
.end method

.method private a(Les/v8;)V
    .locals 2

    .line 1
    new-instance v0, Lcom/esfile/screen/recorder/media/glutils/e;

    invoke-direct {v0, p1}, Lcom/esfile/screen/recorder/media/glutils/e;-><init>(Les/v8;)V

    iput-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->g:Lcom/esfile/screen/recorder/media/glutils/e;

    .line 2
    invoke-virtual {v0}, Lcom/esfile/screen/recorder/media/glutils/e;->c()V

    .line 3
    new-instance p1, Landroid/graphics/SurfaceTexture;

    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->g:Lcom/esfile/screen/recorder/media/glutils/e;

    invoke-virtual {v0}, Lcom/esfile/screen/recorder/media/glutils/e;->b()I

    move-result v0

    invoke-direct {p1, v0}, Landroid/graphics/SurfaceTexture;-><init>(I)V

    iput-object p1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->e:Landroid/graphics/SurfaceTexture;

    .line 4
    new-instance p1, Landroid/os/HandlerThread;

    const-string v0, "outputsurface"

    invoke-direct {p1, v0}, Landroid/os/HandlerThread;-><init>(Ljava/lang/String;)V

    iput-object p1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->l:Landroid/os/HandlerThread;

    .line 5
    invoke-virtual {p1}, Landroid/os/HandlerThread;->start()V

    .line 6
    iget-object p1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->e:Landroid/graphics/SurfaceTexture;

    new-instance v0, Landroid/os/Handler;

    iget-object v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->l:Landroid/os/HandlerThread;

    invoke-virtual {v1}, Landroid/os/HandlerThread;->getLooper()Landroid/os/Looper;

    move-result-object v1

    invoke-direct {v0, v1}, Landroid/os/Handler;-><init>(Landroid/os/Looper;)V

    invoke-virtual {p1, p0, v0}, Landroid/graphics/SurfaceTexture;->setOnFrameAvailableListener(Landroid/graphics/SurfaceTexture$OnFrameAvailableListener;Landroid/os/Handler;)V

    .line 7
    new-instance p1, Landroid/view/Surface;

    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->e:Landroid/graphics/SurfaceTexture;

    invoke-direct {p1, v0}, Landroid/view/Surface;-><init>(Landroid/graphics/SurfaceTexture;)V

    iput-object p1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->f:Landroid/view/Surface;

    return-void
.end method

.method private a(Ljava/lang/String;)V
    .locals 3

    const/4 v0, 0x0

    .line 40
    :goto_0
    iget-object v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->a:Ljavax/microedition/khronos/egl/EGL10;

    invoke-interface {v1}, Ljavax/microedition/khronos/egl/EGL10;->eglGetError()I

    move-result v1

    const/16 v2, 0x3000

    if-eq v1, v2, :cond_0

    .line 41
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v2, ": EGL error: 0x"

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-static {v1}, Ljava/lang/Integer;->toHexString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const-string v1, "OutputSurface"

    invoke-static {v1, v0}, Lcom/esfile/screen/recorder/media/util/k;->a(Ljava/lang/String;Ljava/lang/String;)V

    const/4 v0, 0x1

    goto :goto_0

    :cond_0
    if-nez v0, :cond_1

    return-void

    .line 42
    :cond_1
    new-instance p1, Ljava/lang/RuntimeException;

    const-string v0, "EGL error encountered (see log)"

    invoke-direct {p1, v0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    goto :goto_2

    :goto_1
    throw p1

    :goto_2
    goto :goto_1
.end method

.method private c(II)V
    .locals 9

    .line 1
    invoke-static {}, Ljavax/microedition/khronos/egl/EGLContext;->getEGL()Ljavax/microedition/khronos/egl/EGL;

    move-result-object v0

    check-cast v0, Ljavax/microedition/khronos/egl/EGL10;

    iput-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->a:Ljavax/microedition/khronos/egl/EGL10;

    .line 2
    sget-object v1, Ljavax/microedition/khronos/egl/EGL10;->EGL_DEFAULT_DISPLAY:Ljava/lang/Object;

    invoke-interface {v0, v1}, Ljavax/microedition/khronos/egl/EGL10;->eglGetDisplay(Ljava/lang/Object;)Ljavax/microedition/khronos/egl/EGLDisplay;

    move-result-object v0

    iput-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->b:Ljavax/microedition/khronos/egl/EGLDisplay;

    .line 3
    iget-object v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->a:Ljavax/microedition/khronos/egl/EGL10;

    const/4 v2, 0x0

    invoke-interface {v1, v0, v2}, Ljavax/microedition/khronos/egl/EGL10;->eglInitialize(Ljavax/microedition/khronos/egl/EGLDisplay;[I)Z

    move-result v0

    if-eqz v0, :cond_3

    const/16 v0, 0xd

    new-array v3, v0, [I

    .line 4
    fill-array-data v3, :array_0

    const/4 v0, 0x1

    new-array v7, v0, [Ljavax/microedition/khronos/egl/EGLConfig;

    new-array v6, v0, [I

    .line 5
    iget-object v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->a:Ljavax/microedition/khronos/egl/EGL10;

    iget-object v2, p0, Lcom/esfile/screen/recorder/media/glutils/d;->b:Ljavax/microedition/khronos/egl/EGLDisplay;

    const/4 v5, 0x1

    move-object v4, v7

    invoke-interface/range {v1 .. v6}, Ljavax/microedition/khronos/egl/EGL10;->eglChooseConfig(Ljavax/microedition/khronos/egl/EGLDisplay;[I[Ljavax/microedition/khronos/egl/EGLConfig;I[I)Z

    move-result v1

    if-eqz v1, :cond_2

    const/4 v1, 0x3

    new-array v2, v1, [I

    .line 6
    fill-array-data v2, :array_1

    .line 7
    iget-object v3, p0, Lcom/esfile/screen/recorder/media/glutils/d;->a:Ljavax/microedition/khronos/egl/EGL10;

    iget-object v4, p0, Lcom/esfile/screen/recorder/media/glutils/d;->b:Ljavax/microedition/khronos/egl/EGLDisplay;

    const/4 v5, 0x0

    aget-object v6, v7, v5

    sget-object v8, Ljavax/microedition/khronos/egl/EGL10;->EGL_NO_CONTEXT:Ljavax/microedition/khronos/egl/EGLContext;

    invoke-interface {v3, v4, v6, v8, v2}, Ljavax/microedition/khronos/egl/EGL10;->eglCreateContext(Ljavax/microedition/khronos/egl/EGLDisplay;Ljavax/microedition/khronos/egl/EGLConfig;Ljavax/microedition/khronos/egl/EGLContext;[I)Ljavax/microedition/khronos/egl/EGLContext;

    move-result-object v2

    iput-object v2, p0, Lcom/esfile/screen/recorder/media/glutils/d;->c:Ljavax/microedition/khronos/egl/EGLContext;

    const-string v2, "eglCreateContext"

    .line 8
    invoke-direct {p0, v2}, Lcom/esfile/screen/recorder/media/glutils/d;->a(Ljava/lang/String;)V

    .line 9
    iget-object v2, p0, Lcom/esfile/screen/recorder/media/glutils/d;->c:Ljavax/microedition/khronos/egl/EGLContext;

    if-eqz v2, :cond_1

    const/4 v2, 0x5

    new-array v2, v2, [I

    const/16 v3, 0x3057

    aput v3, v2, v5

    aput p1, v2, v0

    const/4 v0, 0x2

    const/16 v3, 0x3056

    aput v3, v2, v0

    aput p2, v2, v1

    const/4 v0, 0x4

    const/16 v1, 0x3038

    aput v1, v2, v0

    .line 10
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->a:Ljavax/microedition/khronos/egl/EGL10;

    iget-object v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->b:Ljavax/microedition/khronos/egl/EGLDisplay;

    aget-object v3, v7, v5

    invoke-interface {v0, v1, v3, v2}, Ljavax/microedition/khronos/egl/EGL10;->eglCreatePbufferSurface(Ljavax/microedition/khronos/egl/EGLDisplay;Ljavax/microedition/khronos/egl/EGLConfig;[I)Ljavax/microedition/khronos/egl/EGLSurface;

    move-result-object v0

    iput-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->d:Ljavax/microedition/khronos/egl/EGLSurface;

    const-string v0, "eglCreatePbufferSurface"

    .line 11
    invoke-direct {p0, v0}, Lcom/esfile/screen/recorder/media/glutils/d;->a(Ljava/lang/String;)V

    .line 12
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->d:Ljavax/microedition/khronos/egl/EGLSurface;

    if-eqz v0, :cond_0

    .line 13
    invoke-virtual {p0, p1, p2}, Lcom/esfile/screen/recorder/media/glutils/d;->a(II)V

    return-void

    .line 14
    :cond_0
    new-instance p1, Ljava/lang/RuntimeException;

    const-string p2, "surface was null"

    invoke-direct {p1, p2}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw p1

    .line 15
    :cond_1
    new-instance p1, Ljava/lang/RuntimeException;

    const-string p2, "null context"

    invoke-direct {p1, p2}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw p1

    .line 16
    :cond_2
    new-instance p1, Ljava/lang/RuntimeException;

    const-string p2, "unable to find RGB8888+pbuffer EGL config"

    invoke-direct {p1, p2}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw p1

    .line 17
    :cond_3
    new-instance p1, Ljava/lang/RuntimeException;

    const-string p2, "unable to initialize EGL10"

    invoke-direct {p1, p2}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw p1

    nop

    :array_0
    .array-data 4
        0x3024
        0x8
        0x3023
        0x8
        0x3022
        0x8
        0x3021
        0x8
        0x3033
        0x1
        0x3040
        0x4
        0x3038
    .end array-data

    :array_1
    .array-data 4
        0x3098
        0x2
        0x3038
    .end array-data
.end method

.method private k()V
    .locals 2

    .line 1
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->n:Ljava/nio/ByteBuffer;

    if-nez v0, :cond_0

    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->k:Lcom/esfile/screen/recorder/media/util/y;

    if-eqz v0, :cond_0

    .line 2
    invoke-virtual {v0}, Lcom/esfile/screen/recorder/media/util/y;->a()I

    move-result v0

    iget-object v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->k:Lcom/esfile/screen/recorder/media/util/y;

    invoke-virtual {v1}, Lcom/esfile/screen/recorder/media/util/y;->b()I

    move-result v1

    mul-int v0, v0, v1

    mul-int/lit8 v0, v0, 0x4

    invoke-static {v0}, Ljava/nio/ByteBuffer;->allocateDirect(I)Ljava/nio/ByteBuffer;

    move-result-object v0

    iput-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->n:Ljava/nio/ByteBuffer;

    .line 3
    sget-object v1, Ljava/nio/ByteOrder;->LITTLE_ENDIAN:Ljava/nio/ByteOrder;

    invoke-virtual {v0, v1}, Ljava/nio/ByteBuffer;->order(Ljava/nio/ByteOrder;)Ljava/nio/ByteBuffer;

    :cond_0
    return-void
.end method


# virtual methods
.method public a()V
    .locals 2

    const-wide/16 v0, -0x1

    .line 25
    invoke-virtual {p0, v0, v1}, Lcom/esfile/screen/recorder/media/glutils/d;->a(J)V

    return-void
.end method

.method public a(I)V
    .locals 3

    if-eqz p1, :cond_1

    const/16 v0, 0x5a

    if-eq p1, v0, :cond_1

    const/16 v0, 0xb4

    if-eq p1, v0, :cond_1

    const/16 v0, 0x10e

    if-ne p1, v0, :cond_0

    goto :goto_0

    .line 21
    :cond_0
    new-instance v0, Ljava/lang/IllegalArgumentException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Unsupported angle: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-direct {v0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 22
    :cond_1
    :goto_0
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->g:Lcom/esfile/screen/recorder/media/glutils/e;

    if-eqz v0, :cond_2

    iget v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->m:I

    if-eq p1, v1, :cond_2

    sub-int v1, p1, v1

    .line 23
    invoke-virtual {v0, v1}, Lcom/esfile/screen/recorder/media/glutils/e;->a(I)V

    .line 24
    iput p1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->m:I

    :cond_2
    return-void
.end method

.method public a(II)V
    .locals 1

    .line 8
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->k:Lcom/esfile/screen/recorder/media/util/y;

    if-nez v0, :cond_0

    .line 9
    new-instance v0, Lcom/esfile/screen/recorder/media/util/y;

    invoke-direct {v0, p1, p2}, Lcom/esfile/screen/recorder/media/util/y;-><init>(II)V

    iput-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->k:Lcom/esfile/screen/recorder/media/util/y;

    :cond_0
    return-void
.end method

.method public a(IILcom/esfile/screen/recorder/media/util/ScaleTypeUtil$ScaleType;)V
    .locals 2
    .param p3    # Lcom/esfile/screen/recorder/media/util/ScaleTypeUtil$ScaleType;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param

    .line 10
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->k:Lcom/esfile/screen/recorder/media/util/y;

    if-nez v0, :cond_0

    return-void

    :cond_0
    if-lez p1, :cond_1

    if-lez p2, :cond_1

    .line 11
    sget-object v1, Lcom/esfile/screen/recorder/media/util/ScaleTypeUtil$ScaleType;->UNKNOWN:Lcom/esfile/screen/recorder/media/util/ScaleTypeUtil$ScaleType;

    if-eq p3, v1, :cond_1

    .line 12
    invoke-virtual {v0}, Lcom/esfile/screen/recorder/media/util/y;->b()I

    move-result v0

    iget-object v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->k:Lcom/esfile/screen/recorder/media/util/y;

    invoke-virtual {v1}, Lcom/esfile/screen/recorder/media/util/y;->a()I

    move-result v1

    invoke-static {v0, v1, p1, p2, p3}, Lcom/esfile/screen/recorder/media/util/ScaleTypeUtil;->a(IIIILcom/esfile/screen/recorder/media/util/ScaleTypeUtil$ScaleType;)Landroid/graphics/Rect;

    move-result-object p1

    .line 13
    invoke-direct {p0, p1}, Lcom/esfile/screen/recorder/media/glutils/d;->a(Landroid/graphics/Rect;)V

    goto :goto_0

    .line 14
    :cond_1
    new-instance p1, Landroid/graphics/Rect;

    iget-object p2, p0, Lcom/esfile/screen/recorder/media/glutils/d;->k:Lcom/esfile/screen/recorder/media/util/y;

    invoke-virtual {p2}, Lcom/esfile/screen/recorder/media/util/y;->b()I

    move-result p2

    iget-object p3, p0, Lcom/esfile/screen/recorder/media/glutils/d;->k:Lcom/esfile/screen/recorder/media/util/y;

    invoke-virtual {p3}, Lcom/esfile/screen/recorder/media/util/y;->a()I

    move-result p3

    const/4 v0, 0x0

    invoke-direct {p1, v0, v0, p2, p3}, Landroid/graphics/Rect;-><init>(IIII)V

    invoke-direct {p0, p1}, Lcom/esfile/screen/recorder/media/glutils/d;->a(Landroid/graphics/Rect;)V

    :goto_0
    return-void
.end method

.method public a(J)V
    .locals 4

    .line 26
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->i:Ljava/lang/Object;

    monitor-enter v0

    .line 27
    :try_start_0
    iget v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->j:I
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-nez v1, :cond_1

    const-wide/16 v1, 0x0

    cmp-long v3, p1, v1

    if-gez v3, :cond_0

    .line 28
    :try_start_1
    iget-object p1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->i:Ljava/lang/Object;

    invoke-virtual {p1}, Ljava/lang/Object;->wait()V

    goto :goto_0

    :cond_0
    cmp-long v3, p1, v1

    if-lez v3, :cond_1

    .line 29
    iget-object v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->i:Ljava/lang/Object;

    invoke-virtual {v1, p1, p2}, Ljava/lang/Object;->wait(J)V
    :try_end_1
    .catch Ljava/lang/InterruptedException; {:try_start_1 .. :try_end_1} :catch_0
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    .line 30
    :catch_0
    :try_start_2
    monitor-exit v0

    return-void

    .line 31
    :cond_1
    :goto_0
    iget p1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->j:I

    const/4 p2, 0x0

    .line 32
    iput p2, p0, Lcom/esfile/screen/recorder/media/glutils/d;->j:I

    const/4 p2, 0x1

    if-eq p1, p2, :cond_2

    .line 33
    monitor-exit v0

    return-void

    .line 34
    :cond_2
    monitor-exit v0
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    const-string p1, "before updateTexImage"

    .line 35
    invoke-static {p1}, Lcom/esfile/screen/recorder/media/glutils/b;->a(Ljava/lang/String;)V

    .line 36
    iget-object p1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->e:Landroid/graphics/SurfaceTexture;

    invoke-virtual {p1}, Landroid/graphics/SurfaceTexture;->updateTexImage()V

    return-void

    :catchall_0
    move-exception p1

    .line 37
    :try_start_3
    monitor-exit v0
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_0

    throw p1
.end method

.method public a(Z)V
    .locals 1

    .line 38
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->g:Lcom/esfile/screen/recorder/media/glutils/e;

    if-eqz v0, :cond_0

    .line 39
    invoke-virtual {v0, p1}, Lcom/esfile/screen/recorder/media/glutils/e;->a(Z)V

    :cond_0
    return-void
.end method

.method public b()I
    .locals 1

    .line 3
    iget v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->m:I

    return v0
.end method

.method public b(Z)Ljava/nio/ByteBuffer;
    .locals 7

    .line 10
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->k:Lcom/esfile/screen/recorder/media/util/y;

    if-nez v0, :cond_0

    const/4 p1, 0x0

    return-object p1

    :cond_0
    if-eqz p1, :cond_1

    .line 11
    invoke-virtual {p0}, Lcom/esfile/screen/recorder/media/glutils/d;->a()V

    const-wide/16 v0, -0x1

    .line 12
    invoke-virtual {p0, v0, v1}, Lcom/esfile/screen/recorder/media/glutils/d;->b(J)V

    .line 13
    :cond_1
    invoke-direct {p0}, Lcom/esfile/screen/recorder/media/glutils/d;->k()V

    .line 14
    iget-object p1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->n:Ljava/nio/ByteBuffer;

    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->rewind()Ljava/nio/Buffer;

    const/4 v0, 0x0

    const/4 v1, 0x0

    .line 15
    iget-object p1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->k:Lcom/esfile/screen/recorder/media/util/y;

    invoke-virtual {p1}, Lcom/esfile/screen/recorder/media/util/y;->b()I

    move-result v2

    iget-object p1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->k:Lcom/esfile/screen/recorder/media/util/y;

    invoke-virtual {p1}, Lcom/esfile/screen/recorder/media/util/y;->a()I

    move-result v3

    const/16 v4, 0x1908

    const/16 v5, 0x1401

    iget-object v6, p0, Lcom/esfile/screen/recorder/media/glutils/d;->n:Ljava/nio/ByteBuffer;

    invoke-static/range {v0 .. v6}, Landroid/opengl/GLES20;->glReadPixels(IIIIIILjava/nio/Buffer;)V

    .line 16
    iget-object p1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->n:Ljava/nio/ByteBuffer;

    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->rewind()Ljava/nio/Buffer;

    .line 17
    iget-object p1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->n:Ljava/nio/ByteBuffer;

    return-object p1
.end method

.method protected b(II)V
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->e:Landroid/graphics/SurfaceTexture;

    if-eqz v0, :cond_0

    .line 2
    invoke-virtual {v0, p1, p2}, Landroid/graphics/SurfaceTexture;->setDefaultBufferSize(II)V

    :cond_0
    return-void
.end method

.method public final b(J)V
    .locals 2

    const/4 v0, 0x0

    const/high16 v1, 0x3f800000    # 1.0f

    .line 4
    invoke-static {v0, v0, v0, v1}, Landroid/opengl/GLES20;->glClearColor(FFFF)V

    const/16 v0, 0x4100

    .line 5
    invoke-static {v0}, Landroid/opengl/GLES20;->glClear(I)V

    .line 6
    invoke-virtual {p0, p1, p2}, Lcom/esfile/screen/recorder/media/glutils/d;->d(J)V

    .line 7
    iget-boolean v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->h:Z

    if-nez v0, :cond_0

    .line 8
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->g:Lcom/esfile/screen/recorder/media/glutils/e;

    iget-object v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->e:Landroid/graphics/SurfaceTexture;

    invoke-virtual {v0, v1}, Lcom/esfile/screen/recorder/media/glutils/e;->a(Landroid/graphics/SurfaceTexture;)V

    .line 9
    :cond_0
    invoke-virtual {p0, p1, p2}, Lcom/esfile/screen/recorder/media/glutils/d;->c(J)V

    return-void
.end method

.method public c()Landroid/view/Surface;
    .locals 1

    .line 18
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->f:Landroid/view/Surface;

    return-object v0
.end method

.method protected c(J)V
    .locals 0

    return-void
.end method

.method public d()V
    .locals 2

    .line 1
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->i:Ljava/lang/Object;

    monitor-enter v0

    const/4 v1, 0x2

    .line 2
    :try_start_0
    iput v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->j:I

    .line 3
    iget-object v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->i:Ljava/lang/Object;

    invoke-virtual {v1}, Ljava/lang/Object;->notifyAll()V

    .line 4
    monitor-exit v0

    return-void

    :catchall_0
    move-exception v1

    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v1
.end method

.method protected d(J)V
    .locals 0

    return-void
.end method

.method public e()V
    .locals 4

    .line 1
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->a:Ljavax/microedition/khronos/egl/EGL10;

    if-eqz v0, :cond_1

    const-string v0, "before makeCurrent"

    .line 2
    invoke-direct {p0, v0}, Lcom/esfile/screen/recorder/media/glutils/d;->a(Ljava/lang/String;)V

    .line 3
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->a:Ljavax/microedition/khronos/egl/EGL10;

    iget-object v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->b:Ljavax/microedition/khronos/egl/EGLDisplay;

    iget-object v2, p0, Lcom/esfile/screen/recorder/media/glutils/d;->d:Ljavax/microedition/khronos/egl/EGLSurface;

    iget-object v3, p0, Lcom/esfile/screen/recorder/media/glutils/d;->c:Ljavax/microedition/khronos/egl/EGLContext;

    invoke-interface {v0, v1, v2, v2, v3}, Ljavax/microedition/khronos/egl/EGL10;->eglMakeCurrent(Ljavax/microedition/khronos/egl/EGLDisplay;Ljavax/microedition/khronos/egl/EGLSurface;Ljavax/microedition/khronos/egl/EGLSurface;Ljavax/microedition/khronos/egl/EGLContext;)Z

    move-result v0

    if-eqz v0, :cond_0

    return-void

    .line 4
    :cond_0
    new-instance v0, Ljava/lang/RuntimeException;

    const-string v1, "eglMakeCurrent failed"

    invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 5
    :cond_1
    new-instance v0, Ljava/lang/RuntimeException;

    const-string v1, "not configured for makeCurrent"

    invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v0
.end method

.method public f()V
    .locals 0

    return-void
.end method

.method public g()V
    .locals 0

    return-void
.end method

.method public h()V
    .locals 5

    .line 1
    invoke-virtual {p0}, Lcom/esfile/screen/recorder/media/glutils/d;->d()V

    .line 2
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->a:Ljavax/microedition/khronos/egl/EGL10;

    const/4 v1, 0x0

    if-eqz v0, :cond_1

    .line 3
    invoke-interface {v0}, Ljavax/microedition/khronos/egl/EGL10;->eglGetCurrentContext()Ljavax/microedition/khronos/egl/EGLContext;

    move-result-object v0

    iget-object v2, p0, Lcom/esfile/screen/recorder/media/glutils/d;->c:Ljavax/microedition/khronos/egl/EGLContext;

    invoke-virtual {v0, v2}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 4
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->a:Ljavax/microedition/khronos/egl/EGL10;

    iget-object v2, p0, Lcom/esfile/screen/recorder/media/glutils/d;->b:Ljavax/microedition/khronos/egl/EGLDisplay;

    sget-object v3, Ljavax/microedition/khronos/egl/EGL10;->EGL_NO_SURFACE:Ljavax/microedition/khronos/egl/EGLSurface;

    sget-object v4, Ljavax/microedition/khronos/egl/EGL10;->EGL_NO_CONTEXT:Ljavax/microedition/khronos/egl/EGLContext;

    invoke-interface {v0, v2, v3, v3, v4}, Ljavax/microedition/khronos/egl/EGL10;->eglMakeCurrent(Ljavax/microedition/khronos/egl/EGLDisplay;Ljavax/microedition/khronos/egl/EGLSurface;Ljavax/microedition/khronos/egl/EGLSurface;Ljavax/microedition/khronos/egl/EGLContext;)Z

    .line 5
    :cond_0
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->a:Ljavax/microedition/khronos/egl/EGL10;

    iget-object v2, p0, Lcom/esfile/screen/recorder/media/glutils/d;->b:Ljavax/microedition/khronos/egl/EGLDisplay;

    iget-object v3, p0, Lcom/esfile/screen/recorder/media/glutils/d;->d:Ljavax/microedition/khronos/egl/EGLSurface;

    invoke-interface {v0, v2, v3}, Ljavax/microedition/khronos/egl/EGL10;->eglDestroySurface(Ljavax/microedition/khronos/egl/EGLDisplay;Ljavax/microedition/khronos/egl/EGLSurface;)Z

    .line 6
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->a:Ljavax/microedition/khronos/egl/EGL10;

    iget-object v2, p0, Lcom/esfile/screen/recorder/media/glutils/d;->b:Ljavax/microedition/khronos/egl/EGLDisplay;

    iget-object v3, p0, Lcom/esfile/screen/recorder/media/glutils/d;->c:Ljavax/microedition/khronos/egl/EGLContext;

    invoke-interface {v0, v2, v3}, Ljavax/microedition/khronos/egl/EGL10;->eglDestroyContext(Ljavax/microedition/khronos/egl/EGLDisplay;Ljavax/microedition/khronos/egl/EGLContext;)Z

    .line 7
    iput-object v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->b:Ljavax/microedition/khronos/egl/EGLDisplay;

    .line 8
    iput-object v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->c:Ljavax/microedition/khronos/egl/EGLContext;

    .line 9
    iput-object v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->d:Ljavax/microedition/khronos/egl/EGLSurface;

    .line 10
    iput-object v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->a:Ljavax/microedition/khronos/egl/EGL10;

    .line 11
    :cond_1
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->f:Landroid/view/Surface;

    if-eqz v0, :cond_2

    .line 12
    invoke-virtual {v0}, Landroid/view/Surface;->release()V

    .line 13
    iput-object v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->f:Landroid/view/Surface;

    .line 14
    :cond_2
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->g:Lcom/esfile/screen/recorder/media/glutils/e;

    if-eqz v0, :cond_3

    .line 15
    invoke-virtual {v0}, Lcom/esfile/screen/recorder/media/glutils/e;->d()V

    .line 16
    iput-object v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->g:Lcom/esfile/screen/recorder/media/glutils/e;

    .line 17
    :cond_3
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->e:Landroid/graphics/SurfaceTexture;

    if-eqz v0, :cond_4

    .line 18
    invoke-virtual {v0}, Landroid/graphics/SurfaceTexture;->release()V

    .line 19
    iput-object v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->e:Landroid/graphics/SurfaceTexture;

    .line 20
    :cond_4
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->l:Landroid/os/HandlerThread;

    if-eqz v0, :cond_5

    .line 21
    invoke-virtual {v0}, Landroid/os/HandlerThread;->quitSafely()Z

    .line 22
    :cond_5
    invoke-virtual {p0}, Lcom/esfile/screen/recorder/media/glutils/d;->g()V

    return-void
.end method

.method public i()Landroid/graphics/Bitmap;
    .locals 3

    .line 1
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->k:Lcom/esfile/screen/recorder/media/util/y;

    const/4 v1, 0x0

    if-nez v0, :cond_0

    return-object v1

    .line 2
    :cond_0
    invoke-virtual {p0}, Lcom/esfile/screen/recorder/media/glutils/d;->j()Ljava/nio/ByteBuffer;

    .line 3
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->n:Ljava/nio/ByteBuffer;

    if-eqz v0, :cond_1

    invoke-virtual {v0}, Ljava/nio/ByteBuffer;->remaining()I

    move-result v0

    if-lez v0, :cond_1

    .line 4
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->k:Lcom/esfile/screen/recorder/media/util/y;

    invoke-virtual {v0}, Lcom/esfile/screen/recorder/media/util/y;->b()I

    move-result v0

    iget-object v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->k:Lcom/esfile/screen/recorder/media/util/y;

    invoke-virtual {v1}, Lcom/esfile/screen/recorder/media/util/y;->a()I

    move-result v1

    sget-object v2, Landroid/graphics/Bitmap$Config;->ARGB_8888:Landroid/graphics/Bitmap$Config;

    invoke-static {v0, v1, v2}, Landroid/graphics/Bitmap;->createBitmap(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;

    move-result-object v0

    .line 5
    iget-object v1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->n:Ljava/nio/ByteBuffer;

    invoke-virtual {v0, v1}, Landroid/graphics/Bitmap;->copyPixelsFromBuffer(Ljava/nio/Buffer;)V

    return-object v0

    :cond_1
    return-object v1
.end method

.method public j()Ljava/nio/ByteBuffer;
    .locals 1

    const/4 v0, 0x1

    .line 1
    invoke-virtual {p0, v0}, Lcom/esfile/screen/recorder/media/glutils/d;->b(Z)Ljava/nio/ByteBuffer;

    move-result-object v0

    return-object v0
.end method

.method public final onFrameAvailable(Landroid/graphics/SurfaceTexture;)V
    .locals 1

    .line 1
    iget-object p1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->i:Ljava/lang/Object;

    monitor-enter p1

    const/4 v0, 0x1

    .line 2
    :try_start_0
    iput v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->j:I

    .line 3
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/glutils/d;->i:Ljava/lang/Object;

    invoke-virtual {v0}, Ljava/lang/Object;->notifyAll()V

    .line 4
    monitor-exit p1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 5
    invoke-virtual {p0}, Lcom/esfile/screen/recorder/media/glutils/d;->f()V

    .line 6
    iget-object p1, p0, Lcom/esfile/screen/recorder/media/glutils/d;->o:Lcom/esfile/screen/recorder/media/glutils/d$a;

    if-eqz p1, :cond_0

    .line 7
    invoke-interface {p1, p0}, Lcom/esfile/screen/recorder/media/glutils/d$a;->a(Lcom/esfile/screen/recorder/media/glutils/d;)V

    :cond_0
    return-void

    :catchall_0
    move-exception v0

    .line 8
    :try_start_1
    monitor-exit p1
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw v0
.end method
